import request from '../utils/request';

/**
 * 获取购物车列表
 */
export const getCartListApi = () => {
  return request(`/mall-api/cart/getCartList`);
}

/**
 * 添加购物车
 */
export const addToCartApi = ({
  goodsId,
  count,
  blessing = ''
}) => {
  return request(`/mall-api/cart/addToCart/${goodsId}/${count}`, {
    blessing
  });
}

/**
 * 单选
 */
export const checkCartApi = (goodsId, isChecked) => {
  return request(`/mall-api/cart/checkCart/${goodsId}/${isChecked}`);
}

/**
 * 全选&全不选
 */
export const checkAllCartApi = (isChecked) => {
  return request(`/mall-api/cart/checkAllCart/${isChecked}`);
}

/**
 * 删除购物车
 */
export const delCartApi = (goodsId) => {
  return request(`/mall-api/cart/delete/${goodsId}`);
}

/**
 * 清空购物车
 */
export const clearCartApi = () => {
  return request(`/mall-api/cart/clear`);
}

